<template>
<div class="land-classify">
  <div class='layer-container'>
    <div class='detail-header'>
      <div class='title-box'>长沙市土地现状分类情况</div>
      <div class='title-btn' :class='{extend:!isFold, fold: isFold}' @click='isFold=!isFold'></div>
    </div>
    <div class='detail-content' v-show='isFold'>
      <div class='total-header'>
        <div class='total-text'>全域国土面积：</div>
        <div class='total-value'>1181596.46<span>公顷</span></div>
      </div>
      <div class='table-data'>
        <div class='table-header'>
          <div class='table-name'></div>
          <div>{{ year }}</div>
          <div>相比去年</div>
        </div>
        <div class='table-list'>
          <div class='list-item' v-for='item in landClassifyData' :key='item.id'>
            <div class='list-parent'>
              <div class='name'><span class='el-icon-arrow-down'></span>{{ item.name }}</div>
              <div class='value'>{{ item.xzmj }}</div>
              <div class='bj-value' :class='{redColor:item.xbmj<0}'>{{ item.xbmj }}</div>
            </div>
            <div class='list-child' v-if='item.children.length>0'>
              <div class='list-child-item' v-for='(child, index) in item.children' :key='index'>
                <div class='name'>{{ child.name }}</div>
                <div class='value'>{{ child.xzmj }}</div>
                <div class='bj-value' :class='{redColor:child.xbmj<0}'>{{ child.xbmj }}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>

<script lang='ts'>
import { Component, Vue, Prop } from 'vue-property-decorator'

@Component({
  name: 'LandClassify',
  components: {
    LandClassify
  }
})

export default class LandClassify extends Vue{
  @Prop() year!: string
  private isFold = true
  private landClassifyData:any = [
    {name: '农用地', id: 'nyd', xzmj: 326651, xbmj: +1500, children: [
        {name: '耕地', xzmj: 309667, xbmj: +1500},
        {name: '种植园用地', xzmj: 6651, xbmj: +5000},
        {name: '草地', xzmj: 5751, xbmj: -2500},
        {name: '其他用地', xzmj: 3151, xbmj: -2500}
      ]},
    {name: '建设用地', id: 'jsyd', xzmj: 187083, xbmj: +6500,children: []},
    {name: '未利用地', id: 'styd', xzmj: 668166, xbmj: -4500,children: []},
  ]
}
</script>

<style scoped lang='scss'>
.layer-container {
  //background: linear-gradient(180.00deg, rgba(0, 33, 96, 0.9) 0%, rgba(0, 33, 96, 0.7) 100%);
  background: url('~@/assets/cockpit/bb-bg.png') no-repeat 0/ 100% 100%;

  .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 12px;

    .title-box {
      color: #bffeff;

      &:before {
        display: inline-block;
        content: '';
        width: 24px;
        height: 24px;
        vertical-align: middle;
        background: url('~@/assets/cockpit/cho-light.png') no-repeat 0/100% 100%;
      }
    }

    .title-btn {
      position: relative;
      width: 24px;
      height: 24px;
      background: linear-gradient(360.00deg, rgba(0, 149, 255, 0.3) 0%, rgba(0, 149, 255, 0) 100%);
      border-radius: 50%;
      cursor: pointer;

      &.extend {
        &:after {
          display: block;
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          background: url('~@/assets/cockpit/cho-up-extend.png') no-repeat 0/100% 100%;
        }
      }
      &.fold{
        &:after {
          display: block;
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          background: url('~@/assets/cockpit/cho-down-fold.png') no-repeat 0/100% 100%;
        }
      }
    }
  }

  .detail-content {
    .total-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      position: relative;
      padding: 0 12px;
      color: #fff;

      &:after {
        display: block;
        content: '';
        position: absolute;
        left: 18px;
        top: 10px;
        z-index: -1;
        height: 10px;
        width: calc(100% - 24px);
        background: linear-gradient(90.00deg, #006aff 0%, rgba(0, 106, 255, 0) 100%);
        opacity: 0.5;
      }

      .total-text {
        position: relative;
        padding-left: 6px;
        &:before{
          display: block;
          content: '';
          position: absolute;
          left: 0;
          top: 3px;
          width: 2px;
          height: 12px;
          background: #00eaff;
        }
      }

      .total-value {
        font-size: 24px !important;
      }
    }

    .table-data {
      padding: 12px;

      .table-header {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 20px;
        background: rgba(255, 255, 255, 0.15);
        color: #bffeff;

        .table-name {
          flex: 0 0 40%;
        }
      }

      .table-list {
        margin-top: 4px;

        .list-item {
          margin-bottom: 4px;

          &:last-child {
            margin-bottom: 0;
          }

          .list-parent {
            display: flex;
            justify-content: space-around;
            align-items: center;
            height: 28px;
            background: rgba(255, 255, 255, 0.05);

            .name {
              flex: 0 0 40%;
              text-align: left;
              color: #00eaff;
              cursor: pointer;

              span {
                margin-right: 8px;
                color: #bffeff;
              }
            }

            .value {
              flex: 1;
              font-size: 20px !important;
              color: #fff;
              text-align: right;
            }

            .bj-value {
              flex: 1;
              font-size: 16px;
              text-align: right;
              color: #0fa;
              &.redColor{
                color: #ff0000;
              }
            }
          }

          .list-child {
            padding: 8px 0;

            .list-child-item {
              display: flex;
              justify-content: space-around;
              align-items: center;
              height: 24px;
              border-bottom: 1px solid rgba(#fff, 0.1);

              .name {
                flex: 0 0 40%;
                padding-left: 36px;
                text-align: left;
                color: #00eaff;
                cursor: pointer;

                span {
                  margin-right: 8px;
                  color: #bffeff;
                }
              }

              .value {
                flex: 1;
                font-size: 16px !important;
                color: #fff;
                text-align: right;
              }

              .bj-value {
                flex: 1;
                font-size: 16px;
                text-align: right;
                color: #0fa;
                &.redColor{
                  color: #ff0000;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
